package com.ruoyi.art.service.impl;

import com.ruoyi.art.domain.ArtWork;
import com.ruoyi.art.mapper.ArtWorkMapper;
import com.ruoyi.art.service.IArtWorkService;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 笔记Service业务层处理
 *
 * @author ruoyi
 * @date 2022-01-29
 */
@Service
public class ArtWorkServiceImpl implements IArtWorkService
{
    @Autowired
    private ArtWorkMapper artWorkMapper;

    /**
     * 查询笔记
     *
     * @param workId 笔记主键
     * @return 笔记
     */
    @Override
    public ArtWork selectArtWorkByWorkId(Long workId)
    {
        return artWorkMapper.selectArtWorkByWorkId(workId);
    }

    /**
     * 查询笔记列表
     *
     * @param artWork 笔记
     * @return 笔记
     */
    @Override
    public List<ArtWork> selectArtWorkList(ArtWork artWork)
    {
        return artWorkMapper.selectArtWorkList(artWork);
    }

    /**
     * 新增笔记
     *
     * @param artWork 笔记
     * @return 结果
     */
    @Override
    public int insertArtWork(ArtWork artWork)
    {
        artWork.setCreateTime(DateUtils.getNowDate());
        return artWorkMapper.insertArtWork(artWork);
    }

    /**
     * 修改笔记
     *
     * @param artWork 笔记
     * @return 结果
     */
    @Override
    public int updateArtWork(ArtWork artWork)
    {
        artWork.setUpdateTime(DateUtils.getNowDate());
        return artWorkMapper.updateArtWork(artWork);
    }

    /**
     * 批量删除笔记
     *
     * @param workIds 需要删除的笔记主键
     * @return 结果
     */
    @Override
    public int deleteArtWorkByWorkIds(Long[] workIds)
    {
        return artWorkMapper.deleteArtWorkByWorkIds(workIds);
    }

    /**
     * 删除笔记信息
     *
     * @param workId 笔记主键
     * @return 结果
     */
    @Override
    public int deleteArtWorkByWorkId(Long workId)
    {
        return artWorkMapper.deleteArtWorkByWorkId(workId);
    }
}
